package com.auto.survey.log

import com.google.gson.Gson

data class LogEntry(
    val level: LogLevel,
    val tag: String,
    val message: String,
    val timestamp: Long = System.currentTimeMillis(),
    val threadName: String = Thread.currentThread().name,
    val stackTrace: String? = null
) {
    // 格式化为 CSV 或 JSON
    fun toCsv(): String = "$timestamp,$level,$tag,$threadName,${message.replace(',', ' ')},$stackTrace"
    fun toJson(): String = Gson().toJson(this)
}